package tests;

import java.nio.file.*;

import static java.nio.file.StandardCopyOption.*;

public class Tests {
    public static void main(String[] args)  {
        Path from = Paths.get("C:\\data\\test.txt");
        Path to = Paths.get("C:\\data\\video.dat");

        try {
            Files.copy(from, to, REPLACE_EXISTING, COPY_ATTRIBUTES );
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        pathAttributes(to);
    }

    public static void pathAttributes(Path path) {

        System.out.println(path);

        System.out.println(path.getRoot());

        for(Path sub: path) {
            System.out.println(sub);
        }

        try {
            System.out.println("exists - " + Files.exists(path));
            System.out.println("isDirectory - " + Files.isDirectory(path));
            System.out.println("isSymbolicLink - " + Files.isSymbolicLink(path));
            System.out.println("isHidden - " + Files.isHidden(path));
            System.out.println("isReadable - " + Files.isReadable(path));
            System.out.println("isWritable - " + Files.isWritable(path));
            System.out.println("isRegularFile - " + Files.isRegularFile(path));
            System.out.println("isExecutable - " + Files.isExecutable(path));
            System.out.println("size - " + Files.size(path) + " bytes");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
